<template>
	<view class="greyBox">
		<view class="sortTitle">全部记录</view>
		<view class="list">
			<view class="item" v-for="(item,index) in applyList" :key="index">
				<view class="bankLogo">
					<img :src='"https://supply.zhongyimotor.com/upload/applet/bank_"+item.bankAbbreviation+"_icon_@2x.png"'
						alt="">
				</view>
				<view class="bankInfo">
					<view class="name">{{item.bank}}</view>
					<view class="date">{{item.timeCreate}}
						<!-- <view class="state pass" v-if="item.status == 4">已通过</view>
						<view class="state refuse" v-else-if="item.status == 0">未通过</view>
						<view class="state review" v-else>审核中</view> -->
					</view>
				</view>
				<view class="creditInfo" v-if="item.status == 4">
					<view class="num">{{item.amount/10000}} 万元</view>
					<view class="text">授信额度</view>
				</view>
				<view class="creditInfo refuse" v-else-if="item.status == 0">
					未通过
				</view>
				<view class="creditInfo reviewing" v-else>
					审核中
				</view>
			</view>
		</view>
		<u-empty src="https://supply.zhongyimotor.com/upload/applet/maorder_kong_img@2x.png" icon-size="296"
			v-if="applyList.length == 0" text="您还没有授信记录噢～" font-size="28" color="#74899A" margin-top="-68"></u-empty>
		<u-no-network></u-no-network>
	</view>
</template>

<script>
	import moment from "moment"
	export default {
		data() {
			return {
				applyList: []
			}
		},
		onShow() {
			this.getList()
		},
		methods: {
			toReCredit(item) {
				uni.navigateTo({
					url: `/pages/creditGranting/index?mode=re&id=${item.id}&remarks=${item.remarks}`
				})
			},
			getList() {
				let params = {
					current: 1,
					size: 99
				}
				this.$api.applyList(params).then(res => {
					this.applyList = res.result.records
					this.applyList.forEach(item => {
						item.timeCreate = moment(item.timeCreate).format('YYYY-MM-DD')
					})
				})
			}
		}
	};
</script>

<style scoped lang="scss">
	.sortTitle {
		height: 68rpx;
		background: #F7F7F7;
		line-height: 68rpx;
		padding: 0 30rpx;
		color: #969696;
	}

	.list {
		background: #FFF;

		.item {
			width: 750rpx;
			height: 160rpx;
			position: relative;
			overflow: hidden;
			padding: 40rpx 30rpx;
			display: flex;

			&::after {
				content: "";
				position: absolute;
				border-bottom: 2rpx solid #F2F2F2;
				left: 30rpx;
				width: 100%;
				bottom: 0;
			}

			.bankLogo {
				line-height: 0;
				width: 72rpx;
				height: 72rpx;
				margin-right: 30rpx;
			}

			.bankInfo {
				margin-right: auto;

				.name {
					font-size: 30rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #4D4D4D;
					margin-bottom: 8rpx;
				}

				.date {
					font-size: 26rpx;
					font-family: ArialMT;
					color: #9D9D9D;
					display: flex;

					.state {
						width: 80rpx;
						height: 34rpx;
						border-radius: 6rpx;
						font-size: 20rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						text-align: center;
						margin-left: 10rpx;
						font-weight: 400;

						&.pass {
							background: #F6FFED;
							border: 2rpx solid #B7EB8F;
							color: #52C41A;
						}

						&.refuse {
							background: #FFF1F0;
							border: 1rpx solid #FFA39E;
							color: #FF4D4F;
						}

						&.review {
							background: #FFF2EA;
							border: 1rpx solid #FCA477;
							color: #FA7533;
						}
					}
				}
			}

			.creditInfo {
				.num {
					font-size: 32rpx;
					font-family: DINAlternate-Bold, DINAlternate;
					font-weight: bold;
					color: #505050;
					margin-bottom: 4rpx;
				}

				.text {
					font-size: 26rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					color: #9D9D9D;
				}

				&.reviewing {
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #FA7533;
					line-height: 40rpx;
				}

				&.refuse {
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #FF4D4F;
					line-height: 40rpx;
				}
			}

			.action {
				width: 148rpx;
				padding-top: 12rpx;

				/deep/button {
					height: 56rpx;
					font-size: 26rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
				}
			}


		}
	}
</style>